<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <a href="https://www.baidu.com" id="test">hello world</a>
    <script>
        var a = document.getElementById("test");
        a.onclick = function(event){
            window.location.href="https://www.sogou.com";
            //组织a默认跳转百度
            //1.
            //return false;
            //2.
            event.preventDefault();
        }
        
        //event做事件在ie9下做window的属性，应改为window.event；在chrome下做事件的参数
        a.onclick = function(event){
            var event;
            try{
                event = event;
            }
            catch(err){
                // ie9以下
                event = window.event();
            }
            window.location.href="https://www.sogou.com";
            event.preventDefault();
        }
    </script>
</body>
</html>